package main

import (
	"gitee/com.xiaoxin/go-send/controllers"
	"gitee/com.xiaoxin/go-send/store"
	"github.com/gin-gonic/gin"
)

func main() {
	store.InitSqlite()

	// 1.创建路由
	r := gin.Default()

	r.LoadHTMLFiles("assets/index.html")
	r.StaticFile("/favicon.ico", "assets/favicon.ico")
	r.Static("static", "assets/static")

	// 2.绑定路由规则，执行的函数
	// gin.Context，封装了request和response
	r.GET("/", func(c *gin.Context) {
		c.HTML(200, "index.html", gin.H{})
	})
	controllers.RegisterRoute(r)
	// 3.监听端口，默认在8080
	// Run("里面不指定端口号默认为8080")
	r.Run(":8000")
}
